package com.passion.solr.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.passion.base.AbstractMpEntity;
import com.passion.search.annotation.SolrIndex;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.solr.core.mapping.SolrDocument;

import java.io.Serializable;
import java.util.Date;

/**
 * 类描述：solr演示core
 *
 * @author ZhuYin
 * @since 2024年12月03日
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@SolrDocument(collection = "t_demo_solr")
@TableName("t_demo_solr")
public class DemoSolrDocument extends AbstractMpEntity<DemoSolrDocument, String> implements Serializable {

    @Id
    private String id;

    /**
     * 类型
     */
    @SolrIndex(name = "demo_type", type = "string", indexed = true, stored = true, multiValued = false)
    private String demoType;

    /**
     * 年份
     */
    @SolrIndex(name = "demo_year", type = "pint", indexed = true, stored = true, multiValued = false)
    private Integer demoYear;

    /**
     * 标题
     */
    @SolrIndex(name = "demo_title", type = "string", indexed = true, stored = true, multiValued = false)
    private String demoTitle;

    /**
     * 作者
     */
    @SolrIndex(name = "demo_author", type = "string", indexed = true, stored = true, multiValued = false)
    private String demoAuthor;

    /**
     * 内容 使用 text_ik 类型即使用 ik 分词器进行分词索引和查询
     */
    @SolrIndex(name = "demo_content", type = "text_ik", indexed = true, stored = true, multiValued = false)
    private String demoContent;

    /**
     * 删除标记：0-正常 1-已删除
     */
    @SolrIndex(name = "del_flag", type = "string", indexed = true, stored = true, multiValued = false)
    private String delFlag;

    /**
     * 创建人ID
     */
    @SolrIndex(name = "create_id", type = "string", indexed = true, stored = true, multiValued = false)
    private String createId;

    /**
     * 创建时间
     */
    @SolrIndex(name = "create_time", type = "pdate", indexed = true, stored = true, multiValued = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新人ID
     */
    @SolrIndex(name = "update_id", type = "string", indexed = true, stored = true, multiValued = false)
    private String updateId;

    /**
     * 更新时间
     */
    @SolrIndex(name = "update_time", type = "pdate", indexed = true, stored = true, multiValued = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 更新人ID
     */
    @SolrIndex(name = "delete_id", type = "string", indexed = true, stored = true, multiValued = false)
    private String deleteId;

    /**
     * 删除时间
     */
    @SolrIndex(name = "delete_time", type = "pdate", indexed = true, stored = true, multiValued = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date deleteTime;

}
